//
//  OrderDetailViewController.m
//  OneCreditTreasure
//
//  Created by iOS Grouper on 16/8/30.
//
//

#import "OrderDetailViewController.h"
#import "YHYcommenTableViewCell.h"
#import "OrderdatailTableViewCell.h"//首付 + 期数+月供cell
@interface OrderDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView *myTableView;
    NSMutableArray *titleArray;
    NSMutableArray *titleArrayTwo;
}

@end

@implementation OrderDetailViewController

- (void)viewWillAppear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = NO;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"订单详情";
    titleArray = [NSMutableArray arrayWithObjects:@"贷款额度(元)",@"保证金(元)",@"还款方式",@"月供(元)",@"月利率",@"总利率(元)", nil];
    titleArrayTwo =[NSMutableArray arrayWithObjects:@"手机",@"手机号",@"身份号", nil];
    self.view.backgroundColor = LV;
    myTableView = [UITableView new];
    myTableView.backgroundColor = LV;
    [self.view addSubview:myTableView];
    myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [myTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.mas_equalTo(self.view);
        make.width.mas_equalTo(kScreenW);
        make.height.mas_equalTo(kScreenH);
        
    }];
    myTableView.delegate = self;
    myTableView.dataSource = self;
    [myTableView registerClass:[YHYcommenTableViewCell class] forCellReuseIdentifier:@"YHYcommenTableViewCell"];
    [myTableView registerClass:[OrderdatailTableViewCell class] forCellReuseIdentifier:@"OrderdatailTableViewCell"];

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 1;
    }
    if (section == 1) {
        return 1;
    }
    if (section == 2) {
        return titleArray.count;
    }
    return titleArrayTwo.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    YHYcommenTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YHYcommenTableViewCell"];
    if (indexPath.section == 0 ) {
        cell.type = TYPEA;
        cell.textL.text = @"2015款 BoxsterStyleEdition2.7L";
    }
    if (indexPath.section == 1) {
        OrderdatailTableViewCell *orderCell = [tableView dequeueReusableCellWithIdentifier:@"OrderdatailTableViewCell"];
        
        return orderCell;
    }
    if (indexPath.section == 2) {
        cell.leftTitleL.text = titleArray[indexPath.row];
    }
    if (indexPath.section == 3) {
        cell.leftTitleL.text = titleArrayTwo[indexPath.row];
    }
    return cell;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 4;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 1) {
        return 100 * AUTO_HEIGHT;
    }
    else{
        return myTableView.rowHeight;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == 3) {
        return 10 *AUTO_HEIGHT;
    }
    else{
    return 0 * AUTO_HEIGHT;
    }
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
